package interfaccia;

import java.util.Observable;
import java.util.Observer;

import javax.swing.JPanel;
import javax.swing.JTextArea;

import filtri.ProxyFiltro;

public class View extends JPanel implements Observer{
	
	private JTextArea area;
	private ProxyFiltro proxy;
	private String newline = "\n";
	

	public View(ProxyFiltro proxy) {
		super();
		this.proxy = proxy;
		proxy.addObserver(this);
		area=new JTextArea();
		area.setEditable(false);
		area.setText("Logs...");
		add(area);
	}
	


	@Override
	public void update(Observable arg0, Object arg1) {
		area.setText("");
		for (int i = 0; i < proxy.getRisultato().size(); i++) {
			area.append(proxy.getRisultato().get(i).toString());
			area.append(newline);
		}
		
	}

	
}
